package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;

/**
 * Created by yanwt on 2017/2/2.
 * 公司销售用户表
 */
@Getter
@Setter
@Entity
@Table(name = "tb_sales_person")
@org.hibernate.annotations.Table(appliesTo = "tb_sales_person",comment = "公司销售用户表")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="sales_person", usage = CacheConcurrencyStrategy.READ_WRITE)
public class SalesPersonEntity extends DataEntity{
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;
    private String name;
    private String phone;
    @Column(columnDefinition = ("int(1) not null comment '状态 -1:锁定 0:未激活 1:激活 '"))
    private int status; //类型
    @ManyToOne
    @JoinColumn(name="we_chat_user_id",columnDefinition=("bigint(20) default null comment '微信用户ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private WeChatUserEntity weChatUser;
}
